package com.ezcms.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ezcms.dao.MemberDao;
import com.ezcms.dao.RoleDao;
import com.ezcms.dao.base.HibernateDao;
import com.ezcms.entity.Member;
import com.ezcms.entity.Role;
 
@Service("memberManager")
@Transactional
public class MemberManager  {
	@Autowired
	private MemberDao memberDao;
	@Autowired
	private RoleDao roleDao;
	public void save(Member m){
		Role r=roleDao.findUniqueBy("name", "ROLE_ADMIN");
		if(r==null){
			r=new Role("ROLE_ADMIN");
		} 
		m.setRole(r);
		memberDao.save(m);
	}
/*	@Autowired
	private MemberDao<T> memberDao;
	public void save(T t){
		memberDao.save(t);
		
	}*/
}
